import request from '@/utils/request'
import { number } from 'echarts'

// 获取分区
interface paramsData {
  $select: string;
}

interface confirmedData {
  id?: number;
  operatorDescription?: string;
}

interface configData {
  type?: number,
  typeCode?: string,
  minValue1?: number,
  minValue2?: number,
  minValue3?: number,
  maxValue1?: number,
  maxValue2?: number,
  maxValue3?: number,
  lastModificationTime?: string,
  id?: number | string,
  creationTime?: string,
  minValue?: number,
  maxValue?: number,
}

// 获取未确认的报警数量
export function getUnconfirmedAlarmApi (data: { SkipCount: number, MaxResultCount: number }) {
  return request({
    // url: '/api1/api/services/app/WarnRecordService/GetWarningRecord',
    url: '/api1/api/app/notification/warnList',
    method: 'get',
    params: { Status: 0, ...data }

  })
}

// 确认报警
export function confirmedAlarmApi (data: number|string) {
  return request({
    // url: '/api1/api/services/app/WarnRecordService/CloseWarn',
    url: `/api1/api/app/notification/${data}/handleAlarm`,
    method: 'post'
    // data: data
  })
}

// 搜索报警信息
export function getSearchAralmApi (data?: any) {
  return request({
    // url: '/api1/api/services/app/WarnRecordService/SearchWarnRecordHistory',
    url: '/api1/api/app/notification/warnList',
    method: 'get',
    params: data
  })
}

// 搜索报警信息
export function submitAlarmConfigApi (data?: paramsData) {
  return request({
    url: '/api1/api/services/app/WarnRecordService/SearchWarnRecordHistory',
    method: 'post',
    data: data
  })
}

// 获取预警数据
export function getAlarmDataApi () {
  return request({
    // url: '/api1/api/services/app/WarningSettingSafetyService/GetAllWarningSettings',
    url: '/api1/api/app/alarmThresholdSetting/warningSettings',
    method: 'get'
  })
}

// 新增预警数据
export function addAlarmDataApi (data: configData) {
  return request({
    url: '/api1/api/services/app/WarningSettingSafetyService/Add',
    method: 'post',
    data: data
  })
}

// 更新预警数据
export function updateAlarmDataApi (data: any) {
  return request({
    // url: '/api1/api/services/app/WarningSettingSafetyService/Update',
    url: '/api1/api/app/alarmThresholdSetting/upsert',
    method: 'post',
    data: data
  })
}

// 删除预警数据
export function delAlarmDataApi (data: configData) {
  return request({
    url: '/api1/api/services/app/WarningSettingSafetyService/Delete',
    method: 'delete',
    data: data
  })
}
